﻿<%@ Page Language="VB" inherits="Boogaloo.Base.UI.BasePage"
title="Mindfly Web Studio's Boogaloo - Installation"
validaterequest="false" maintainscrollpositiononpostback="true"  %>
<%@ import namespace="Boogaloo.Core.UI" %>
<%@import namespace="Boogaloo.Core.BLL" %>
<%@ import namespace="System.IO" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        
        ' check the directory permissions
        lbl_appdata.Text = CheckDirectoryPermissions("~/App_Data/")
        lbl_controls.Text = CheckDirectoryPermissions("~/Controls/")
        lbl_masters.Text = CheckDirectoryPermissions("~/Masters/")
        lbl_uploads.Text = CheckDirectoryPermissions("~/Uploads/")
        
        If lbl_appdata.Text = "Ok" And lbl_controls.Text = "Ok" And lbl_masters.Text = "Ok" And lbl_uploads.Text = "Ok" Then
            
        End If                               
                                
    End Sub
    
    
    Private Function CheckDirectoryPermissions(ByVal directory As String) As String
        Dim message As String = String.Empty
        Dim path As String = Server.MapPath(directory & "check.txt")
        
        Try
            Groove.WriteTextFileContents(path, "confirmation of write permissions")
        Catch ex As Exception
            message = "Not set"
        End Try
        If Not String.Equals(message, "Not set") Then
            Try
                File.Delete(path)
                message = "Ok"
            Catch ex As Exception
                message = "Delete permissions not set"
            End Try
        End If
        Return message
    End Function
    
    
    Private Function MakeConnectionString(ByVal datasource As String, ByVal catalog As String, ByVal username As String, ByVal password As String) As String
        Return String.Format("Data Source={0},1433;Network Library=DBMSSOCN;Initial Catalog={1};User ID={2};Password={3}", datasource, catalog, username, password)                
    End Function
        
    
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Boogaloo Installation</title>
    <link rel="stylesheet" type="text/css" runat="server" href="~/App_Themes/boogaloo/a_boogaloo_reset.css" />
    <link rel="stylesheet" type="text/css" runat="server" href="~/App_Themes/boogaloo/b_boogaloo_extensions.css" />
    <link rel="stylesheet" type="text/css" runat="server" href="~/App_Themes/boogaloo/c_layout.css" />
    <link rel="stylesheet" type="text/css" runat="server" href="~/App_Themes/boogaloo/d_type.css" />
    <link rel="stylesheet" type="text/css" runat="server" href="~/App_Themes/boogaloo/e_color.css" />
    <link rel="stylesheet" type="text/css" runat="server" href="~/App_Themes/boogaloo/f_extensions.css" />
    <link rel="stylesheet" type="text/css" runat="server" href="~/App_Themes/boogaloo/g_print.css" media="print" />
    <link rel="stylesheet" type="text/css" runat="server" href="~/App_Themes/boogaloo/h_mobile.css" media="mobile" />
    <!--[if lt IE 8]>
    <link rel="stylesheet" type="text/css" runat="server" href="~/App_Themes/boogaloo/i_ie.css" />
    <![endif]-->
    <!--[if lt IE 7]>
    <link rel="stylesheet" type="text/css" runat="server" href="~/App_Themes/boogaloo/j_ie6.css" />
    <![endif]-->
</head>
<body>
    <form id="form1" runat="server">
    
    <div id="header">
        <h1><a title="Boogaloo">Boogaloo</a> <span>The <em>groovy</em> way to manage your site.</span></h1>        
    </div>
    
    <div id="content"><div class="section main">
            <h2>Installation - Step 1</h2>
            <div class="box enriched active">
            <h3>Verify directory permissions</h3>
            <ul class="figure list">
                <li>App_Data: <asp:label id="lbl_appdata" runat="server" /></li>
                <li>Controls: <asp:label id="lbl_controls" runat="server" /></li>
                <li>Masters: <asp:label id="lbl_masters" runat="server" /></li>
                <li>Uploads: <asp:label id="lbl_uploads" runat="server" /></li>
            </ul>
            
            <br />
            <asp:hyperlink id="hyp_next" runat="server" text="Next" cssclass="button" navigateurl="~/Install/DBConnection.aspx" />
            </div>
        </div><div class="aside settings">
            
    </div></div>        
    
    </form>
</body>
</html>
